#ifndef FILEVIEW_H
#define FILEVIEW_H

#include <QTreeWidget>
#include <QDebug>
#include <QFileInfo>
#include <QHeaderView>
#include <QFileDialog>
#include <QTreeWidgetItem>
#include <QFileInfo>
#include <QCoreApplication>
#include <QMessageBox>
#include <QColor>
#include <QList>
#include "UpdateFile.h"

/*!
	\brief Widget affichant une liste d'UpdateList sous forme de tree
*/

 class FileView : public QTreeWidget
{
	Q_OBJECT
	
public:
	FileView( QWidget* parent = 0 );
	virtual ~FileView();
        void SetLevelSelectedFiles(char VLP_Level);
	QList<UpdateFile*> getList();
        void Set_Path_Updater(QString VCP_NewPath);
        void Insert_updater(QString VCP_Path, QString VCP_FileName, int VLP_Priority);
public slots:
        void AddFile();                         //Add file with their absolute path
        void AddFolder();                       //Add file recursivly with their absolute path
        void DeleteSelectedFile();              //Delete file in the list
        void setFilelevel(bool VLP_NewValue);     //Set the default Filelevel
        void setCheckDoublon(bool VCB_NewValue); //Set the value of CheckDoublon
        void setFloodMsgBox(bool VCB_NewValue);  //Set the value of floodMsgBox
        //Insert line from XML
        void InsertFileFromXML(QString VCP_Sha1, QString VCP_Path, QString VCP_FileName, int VLP_Priority);
signals:
        void TaskToShowInStatusbar(QString VCP_Msg); //Send a message to the mainwindow.
        void TaskToShowGbEdit(bool VBP_State);      //task to show the GroupBox Edit
        void TaskToEnableGUI(bool VBP_State);       //task to enable or disable controls
        void OneItemWasAdded();                 //Emit when one item is ... added :)
        void NotifyProgress(int VLP_Value, int VLP_ValueMax);

private slots:
        void ItemsSelectedChange();             //Called when an item is selected (task to show the GroupBox Edit)
        void FloodMSg(QString VCP_Msg);             //Intercept the signal TaskToShowInStatusbar and show the msg in msgbox
private:
        void AddQTreeWidgetItem(QString VCP_Filename, char VLP_Level, QString VCP_AbsolutePath, QString VCP_Sha1 = "");
        QFileInfoList getFiles(QDir OXP_FromDir, const QStringList& OXP_Filters, bool VBP_Recursive);
        char     VLM_Filelevel;
        bool    VBM_CheckDoublon;
        bool    VBM_floodMsgBox;
        QString VCM_Path_Updater;
};

#endif // FILEVIEW_H
